package com.common.retrofit.bearusermethod;

import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.service.BearUserService;
import com.common.utils.SortUtils;

import rx.Observable;
import rx.Subscriber;

public class UpdateUserInrfoMethods extends BaseMethods {

    private static UpdateUserInrfoMethods m_ins = null;

    public static UpdateUserInrfoMethods getInstance() {
        if (m_ins == null) {
            synchronized (UpdateUserInrfoMethods.class) {
                if (m_ins == null) {
                    m_ins = new UpdateUserInrfoMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Api/User/";
    }

    private BearUserService initService() {
        return getRetrofit().create(BearUserService.class);
    }


    public void     updateUserInfo     (Subscriber<Object> subscriber , int uid, String  hashid,String username,String sex,String  id_num) {
        String time  = System.currentTimeMillis()+"" ;
        Observable observable = initService().updateUserInfo(time,SortUtils.getMyHash("uid"+uid,"hashid"+hashid ,"time"+time,"username"+username,"sex"+sex,"id_num"+id_num),Constans.ANDROID_APP_ID,"3",
                uid+""
                , hashid
                , username
                , sex
                , id_num
        );
        toSubscribe(observable, subscriber);
    }
}
